package cn.tedu.search.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

//商品类
@Data
@Accessors(chain = true)  //链式set赋值
@AllArgsConstructor   //全参构造器
@NoArgsConstructor    //无参构造
@Document(indexName = "items")
public class Item implements Serializable {

    @Id
    private Long id;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String title;

    //KeyWord  不分词  Test分词
    @Field(type = FieldType.Keyword)
    private String category;

    @Field(type = FieldType.Keyword)
    private String brand;

    @Field(type = FieldType.Double)
    private Double price;

    //图片地址不会成为搜索条件
    @Field(type = FieldType.Keyword,index = false)
    private String imgPath;


}
